﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CustomerService
{
    public partial class CustomerList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<CustomerSearch> custList = (List<CustomerSearch>)Session["CustomerList"];
            if (!IsPostBack)
            {
                ListView1.DataSource = custList;
                ListView1.DataBind();
            }
        }

        protected void btnSelect_Click(object sender, CommandEventArgs e)
        {
            Response.Redirect("EditCustomer.aspx?CustomerID=" + e.CommandArgument);
        }

        protected void ListView_PagePropertiesChanged(object sender, EventArgs e)
        {
            List<CustomerSearch> custList = (List<CustomerSearch>)Session["CustomerList"];
            ListView1.DataSource = custList;
            ListView1.DataBind();
        }

        protected void btnHome_Click(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
        }
    }
}
